import axios from 'axios';
import { req } from './axiosFun';
// 生产
// const rulApi = 'http://8.138.177.7:';
// 测试
// const rulApi = 'http://81.71.0.172:';
// // 本地测试
const rulApi = 'http://127.0.0.1:';
// console.log('basis:', rulApi);
// const gaodemap = 'https://restapi.amap.com/v3/config/district'
// const key = '5100c912975ea7ab3f29bcaf149456ca'
// const LocalApi = 'http://192.168.68.193:10010/api/web';


// 【配置】设置保存
export const ConfigisStart = (params, port) => { return req("PUT", rulApi + port + "/api/update_trace_model", params) };
// 【配置】保存修改的配置
export const ConfigdistrictsSave = (params, port) => { return req("PUT", rulApi + port + "/api/update_sysparams", params) };
// 【配置】保存跟单比例
export const ConfigPercent = (params, port) => { return req("PUT", rulApi + port + "/api/update_trace_percent", params) };

// 【配置】获取配置信息
export const ConfigSetInfo = (port) => { return axios.get(rulApi + port + "/api/query_sysparams") };

// 调用重启接口
export const ConfigReboot = (params,port) => { return req("post", rulApi + port + "/api/restart_sys", params) };

// 重启后状态查询
export const ConfigRebootStatus = (port) => { return axios.get(rulApi + port + "/api/query_restart_status") };

// 获取下单模式
export const ConfigGetOderMode = (port) => { return axios.get(rulApi + port + "/api/query_revert_status") };

// 设置下单模式
export const ConfigSetOderMode = (params, port) => { return req("PUT", rulApi + port + "/api/update_revert_status", params) };

// 获取跟单结果
export const ConfigGetorderlist = (params, port) => { return axios.get(rulApi + port + "/api/get_trace_orderlist?datediff="+params) };

// 获取前后台账号与密码
export const ConfigGetUserpws = (params, port) => { return axios.get(rulApi + port + "/api/query_webuser?webtype="+params) };

// 添加新用户
export const saveAddClassify = (params,port) => { return req("post", rulApi + port  + "/api/create_new_webuser", params) };

// 启用/不启用用户
export const ConfigPutUsersStart = (params, port) => { return req("PUT", rulApi + port + "/api/update_web_users_start", params) };

// 机器信息管理-删除机器信息管理
export const ConfigDeleteUsers = (params, port) => { return req("DELETE", rulApi + port + "/api/delete_webuser",  params) };

// 启用/不启用用户
export const ConfigEditUsers = (params, port) => { return req("PUT", rulApi + port + "/api/update_webuser", params) };

// 异常信息的日志查询
export const ConfigGetException = (port) => { return axios.get(rulApi + port + "/api/query_exception_top") };

// 清除历史订单
export const ConfigClearOrders = (params,port) => { return req("post", rulApi + port + "/api/clear_history_orders") };


// 商品管理-获取商品管理列表
// export const GoodsList = (params) => { return req("post", "/api/Goods/list", params) };
// // 商品管理-保存商品管理
// export const GoodsSave = (params) => { return req("post", "/api/Goods/save", params) };
// // 商品管理-删除商品管理
// export const GoodsDelete = (params) => { return axios.delete("/api/Goods/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

// /**
//  * 机器信息管理
//  **/
// // 机器信息管理-获取机器信息管理列表
// export const MachineList = (params) => { return req("post", "/api/Machine/list", params) };
// // 机器信息管理-保存机器信息管理
// export const MachineSave = (params) => { return req("post", "/api/Machine/save", params) };
// // 机器信息管理-删除机器信息管理
// export const MachineDelete = (params) => { return axios.delete("/api/Machine/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

// /**
//  * 货道信息管理
//  **/
// // 货道信息管理-获取获取货道信息管理列表
// export const MachineAisleList = (params) => { return req("post", "/api/MachineAisle/list", params) };
// // 货道信息管理-删除货道信息管理
// export const MachineAisleDelete = (params) => { return axios.delete("/api/MachineAisle/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// // 货道信息管理-保存货道信息管理
// export const MachineAisleRsave = (params) => { return req("post", "/api/MachineAisle/save", params) };

/**
 * 分类信息管理
 **/
// // 【基础】保存编辑的子分类
// export const saveClassify = (params) => { return req("post", rulApi + "/edit_subitem", params) };
// // 【基础】保存添加的子分类
// export const saveAddClassify = (params) => { return req("post", rulApi + "/add_subitem", params) };
// // 【基础】保存添加的子分类
// export const deleteClassify = (params) => { return req("DELETE", rulApi + "/delete_itemtype", params) };
// // 【配置】设置获取预约时间段
// export const ConfigTimeGet = (params) => { return axios.get(rulApi + "/query_web_timeconfig", params) };
// // 【配置】获取高德的地理区域
// export const getDistricts = (params) => { return axios.get(gaodemap + "?keywords=浦城县&subdistrict=2&key=" + key) };
// // 【配置】获取地理区域
// export const ConfigdistrictsGet = (params) => { return axios.get(rulApi + "/query_web_area_isopen?page=1&limit=10", params) };
// // 【配置】保存放假公告
// export const saveCreateVacation = (params) => { return req("post", rulApi + "/create_top_notices", params) };
